/*
 * 地址标准化
 */
import { getRequest, postRequest } from '/@/lib/axios';

export const asApi = {
  /**
   * @description:更新任务
   * @param {*}
   * @return {*}
   */
  updateAs: (data) => {
    return postRequest('/as/taskInfo/save', data);
  },
  /**
   * @description: 删除任务
   * @param {number} taskId
   * @return {*}
   */
  deleteAs: (taskId) => {
    return getRequest(`/as/taskInfo/delete?id=${taskId}`);
  },
  /**
   * @description: 数据分页查询
   * @param {number} 
   * @return {*}
   */
  searchPage: (data) => {
    return postRequest(`/as/taskInfo/searchPage`,data);
  },
  /**
   * @description: 获取外部任务下拉
   * @param {number} 
   * @return {*}
   */
  findTodoTask: () => {
    return getRequest(`/as/taskInfo/findTodoTask`);
  },
  /**
   * @description: 分词
   * @param {number} 
   * @return {*}
   */
  doSeg: (taskId) => {
    return getRequest(`/as/taskInfo/doSeg?taskId=${taskId}`);
  },
  /**
   * @description: 修复省市区
   * @param {number} 
   * @return {*}
   */
  doFix: (taskId) => {
    return getRequest(`/as/taskInfo/doFix?taskId=${taskId}`);
  },
  /**
   * @description: 地址匹配
   * @param {number} 
   * @return {*}
   */
  doMatch: (taskId) => {
    return getRequest(`/as/taskInfo/doMatch?taskId=${taskId}`);
  },
  /**
   * @description: 数据分页查询
   * @param {number} 
   * @return {*}
   */
  detailPageQuery: (data) => {
    return postRequest(`/as/taskInfo/searchDetailPage`,data);
  },
  /**
   * @description: 对照表分页查询
   * @param {number} 
   * @return {*}
   */
  lookUpPageQuery: (data) => {
    return postRequest(`/as/lookup/searchPage`,data);
  },
  /**
   * @description: 数据初始化
   * @param {number} 
   * @return {*}
   */
  initData: (cityCode,initType) => {
    return getRequest(`/as/lookup/init?cityCode=${cityCode}&initType=${initType}`);
  },
   /**
   * @description: 楼盘es初始化
   * @param {number} 
   * @return {*}
   */
  initLP: (cityCode) => {
    return getRequest(`/as/lookup/initLP?cityCode=${cityCode}`);
  },
  /**
   * 根据地址查找找小区
   * @param {*} addr 
   * @param {*} distance 
   * @returns 
   */
  searchCommunityByAddr: (addr,distance) => {
    return getRequest(`/as/lookup/searchCommunityByAddr?addr=${addr}&distance=${distance}`);
  },
  /**
   * 初始化历史匹配库
  */
  initHistoryMatch: () => {
    return getRequest(`/as/lookup/initHistoryMatch`);
  },
  /**
   * 分页查询
   * 
   * @param {*} data 
   * @returns 
   */
  searchHistoryPage: (data) => {
    return postRequest(`/as/lookup/searchHistoryPage`,data);
  },
  /**
   * 对照表分页ES查询
   * 
   * @param {JSON} data 
   * @returns 
   */
  searchLookupPage: (data) => {
    return postRequest(`/as/lookup/searchLookupPage`,data);
  },
  /**
   * 搜索地址信息
   * 
   * @param {String} addr 
   * @param {Strng} cityCode 
   * @returns 
   */
  searchAddress: (addr,communityName,cityCode) => {
    return getRequest(`/as/lookup/searchAddress?addr=${addr}&communityName=${communityName}&cityCode=${cityCode}`);
  },
};
